package com.design.patterns.list.visitor;

import com.design.patterns.list.visitor.evaluation.element.Man;
import com.design.patterns.list.visitor.evaluation.element.Person;
import com.design.patterns.list.visitor.evaluation.element.Woman;
import com.design.patterns.list.visitor.evaluation.objectstructure.PersonStructure;
import com.design.patterns.list.visitor.evaluation.visitor.Auction;
import com.design.patterns.list.visitor.evaluation.visitor.SuccessAuction;

/**
 * @author Wangzhiwen
 */
public class VisitorClient {

    private static void common(){

        ObjectStructure objectStructure = new ObjectStructure();

        Element elementOne = new ConcreteOneElement();
        Element elementTwo = new ConcreteTwoElement();

        objectStructure.add(elementOne,elementTwo);

        Visitor visitorOne = new ConcreteOneVisitor();
        objectStructure.operating(visitorOne);

        Visitor visitorTwo = new ConcreteTwoVisitor();
        objectStructure.operating(visitorTwo);
    }

    public static void evaluation(){

        PersonStructure personStructure = new PersonStructure();

        Person man = new Man();
        Person woman = new Woman();

        personStructure.add(man,woman);

        Auction success = new SuccessAuction();
        personStructure.personResult(success);

    }

    public static void main(String[] args) {
        common();
        System.out.println("===============================================");
        evaluation();
    }

}
